package com.rongc.client.freight.business.supply.model;

import com.google.gson.annotations.SerializedName;
import com.rongc.client.core.utils.StringUtils;
import com.rongc.client.freight.UniApplication;
import com.rongc.client.freight.base.model.BaseDic;

import java.io.Serializable;

/**
 * Created by ccqx on 2017/7/5.
 */

public class SupplyBean implements Serializable {
//    @SerializedName(value = "carLength",alternate = {"carlength"})
    @SerializedName("carLength")
    String carLength; //车长
    @SerializedName(value = "carModels",alternate = {"carModel"})
//    @SerializedName("carmodels")
    String carModels; // 车型
    @SerializedName("dulk")
    String dilk; // 货物体积
    @SerializedName(value = "endplace",alternate = {"endPlace"})
//    @SerializedName("endplace")
    String endPlace; // 目的地
    @SerializedName("freight")
    String freight; //系统生成价格
    @SerializedName("goods")
    String goods; // 货物名称
    @SerializedName(value = "loadtime",alternate = {"loadTime"})
//    @SerializedName("loadtime")
    String loadTime; // 装货时间
    @SerializedName("message")
    String message; // 给司机留言
    @SerializedName(value = "startplace",alternate = {"startPlace"})
//    @SerializedName("startplace")
    String startPlace; // 出发地
    @SerializedName("user_id")
    String userId; // 用户ID
    @SerializedName(value = "weights",alternate = {"carLoad"})
    String weights; // 重量
    @SerializedName(value = "start_lon",alternate = {"startLon"})
//    @SerializedName("start_lon")
    String startLon; // 出发地经度
    @SerializedName(value = "start_lat",alternate = {"startLat"})
//    @SerializedName("start_lat")
    String startLat; // 出发地纬度
    @SerializedName(value = "end_lon",alternate = {"endLon"})
//    @SerializedName("end_lon")
    String endLon;  // 目的地经度
    @SerializedName(value = "end_lat",alternate = {"endLat"})
//    @SerializedName("end_lat")
    String endLat;  // 目的地纬度
    @SerializedName("id")
    String id; // 货物id
    @SerializedName("create_time")
    String create_time; //
    @SerializedName("type")
    String type; //
    @SerializedName("is_top")
    String is_top; //
    @SerializedName(value = "img",alternate = {"image"})
    String img; //
    @SerializedName(value = "distance",alternate = {"juli"})
    String distance; //
    @SerializedName("nick")
    String nick; //

    @SerializedName("start_ssq")
    String start_ssq; //
    @SerializedName("end_ssq")
    String end_ssq; //


    @SerializedName("jiedanNumber")
    String jiedanNumber; //
    @SerializedName("xiadanNumber")
    String xiadanNumber; //
    @SerializedName("mobile")
    String mobile; //
    @SerializedName("sj_price")
    String sj_price; //

    public String getCarLength() {
        return carLength;
    }

    public void setCarLength(String carLength) {
        this.carLength = carLength;
    }

    public String getCarModels() {
        return carModels;
    }

    public void setCarModels(String carModels) {
        this.carModels = carModels;
    }

    public String getDilk() {
        return dilk;
    }

    public void setDilk(String dilk) {
        this.dilk = dilk;
    }


    public String getFreight() {
        return freight;
    }

    public void setFreight(String freight) {
        this.freight = freight;
    }

    public String getGoods() {
        return goods;
    }

    public void setGoods(String goods) {
        this.goods = goods;
    }

    public String getLoadTime() {
        return loadTime;
    }

    public void setLoadTime(String loadTime) {
        this.loadTime = loadTime;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getStartPlace() {
        if(StringUtils.isEmpty(startPlace)) return getStart_ssq();
        return startPlace;
    }

    public void setStartPlace(String startPlace) {
        this.startPlace = startPlace;
    }

    public String getEndPlace() {
        if(StringUtils.isEmpty(endPlace)) return getEnd_ssq();
        return endPlace;
    }

    public void setEndPlace(String endPlace) {
        this.endPlace = endPlace;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getWeights() {
        return weights;
    }

    public void setWeights(String weights) {
        this.weights = weights;
    }

    public String getStartLon() {
        return startLon;
    }

    public void setStartLon(String startLon) {
        this.startLon = startLon;
    }

    public String getStartLat() {
        return startLat;
    }

    public void setStartLat(String startLat) {
        this.startLat = startLat;
    }

    public String getEndLon() {
        return endLon;
    }

    public void setEndLon(String endLon) {
        this.endLon = endLon;
    }

    public String getEndLat() {
        return endLat;
    }

    public void setEndLat(String endLat) {
        this.endLat = endLat;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIs_top() {
        return is_top;
    }

    public void setIs_top(String is_top) {
        this.is_top = is_top;
    }

    public String getStart_ssq() {
        return start_ssq;
    }

    public void setStart_ssq(String start_ssq) {
        this.start_ssq = start_ssq;
    }

    public String getEnd_ssq() {
        return end_ssq;
    }

    public void setEnd_ssq(String end_ssq) {
        this.end_ssq = end_ssq;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getDistance() {
        return StringUtils.makeDistance(StringUtils.parseDouble(distance));
    }

    public void setDistance(String distance) {
        this.distance = distance;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getJiedanNumber() {
        return jiedanNumber;
    }

    public void setJiedanNumber(String jiedanNumber) {
        this.jiedanNumber = jiedanNumber;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getXiadanNumber() {
        return xiadanNumber;
    }

    public void setXiadanNumber(String xiadanNumber) {
        this.xiadanNumber = xiadanNumber;
    }

    public String getSj_price() {
        return sj_price;
    }

    public void setSj_price(String sj_price) {
        this.sj_price = sj_price;
    }

    public String getFreightByType(){
        switch (UniApplication.getInstance().getType()){
            case BaseDic.IdentityType.DRIVING_TYPE:
                return getSj_price();
            default:
                return getFreight();
        }
    }
}
